import React, { Component } from 'react'
import toastStyle from './toast.module.scss'

class Toast extends Component {
  state = {
    btnMsg: ['取消', '确定'],
  }
  render() {
    const { handleCloseToast } = this.props
    return (
      <div className={toastStyle['toast-wrapper']}>
        <div className={toastStyle['toast-mask']}></div>
        <div className={toastStyle['toast-tip']}>
          <span>{this.props.title}</span> <br />
          {this.state.btnMsg.map((item, index) => {
            return (
              <button onClick={() => handleCloseToast && handleCloseToast(index)} key={item}>
                {item}
              </button>
            )
          })}
        </div>
      </div>
    )
  }
}

Toast.defaultProps = {
  title: '确定删除该商品吗？',
}

export default Toast
